<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<title>作业讲解</title>
		<style>
			
			.sub-nav{
				background-color: black;
				padding: 0.5rem 8rem;
				/* 弹性盒子 */
				display: flex;
				/* 左右分散对齐 */
				justify-content: space-around;
			}
			.sub-nav>div {
				background-color: #fff;
				padding: 0.5rem 1rem;
				border-radius: 5px;
			}
			.nav img{
				display: none;
			}
			
			/* 小于800px */
			@media screen and (max-width: 800px) {
				.sub-nav {
					padding: 0.5rem 0;
				}
			}
			
			/* 小于500px */
			@media screen and (max-width: 500px) {
				.nav img{
					display: block;
				}
				.sub-nav{
					display: none;
				}
				
				.nav:hover .sub-nav{
					display: flex;
					/* 自动换行 */
					flex-wrap: wrap;
				}
				
				.sub-nav>div{
					/* 自动缩放 */
					flex: 1;
					/* 初始宽度 */
					flex-basis: 90%;
					margin: 0.5rem 1rem;
					text-align: center;
				}
			}
			
		</style>
	</head>
	<body>
		<div class="nav">
			<img src="./img/1.png" alt="">
			<div class="sub-nav">
				<div><span>首页</span></div>
				<div>首页首页首页</div>
				<div>首页</div>
				<div>首页首页首页</div>
				<div>首页</div>
				<div>首页</div>
			</div>
		</div>
	</body>
</html>
